﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Init {
    import flash.events.*;
    import flash.utils.*;
    import Classes.util.*;
    import Display.*;

    public class GameFacebookInit extends FacebookInit {

        protected static const SETUP_FRIENDS_TIMER_DELAY:int = 200;
        protected static const IS_DEBUG_TIMER_DELAY:Boolean = false;

        protected var m_friendsTimer:Timer;

        public function GameFacebookInit(_arg1:Boolean){
            super(_arg1, GameFacebookUtil);
        }
        override protected function setupOnFriendsComplete():void{
            this.setupPlayerFriends(null);
        }
        private function setupPlayerFriends(_arg1:Event):void{
            var _local2:Boolean = ((!(IS_DEBUG_TIMER_DELAY)) || (!((_arg1 == null))));
            if (((Global.player) && (_local2))){
                if (this.m_friendsTimer){
                    this.m_friendsTimer.stop();
                    this.m_friendsTimer = null;
                };
                Global.player.setFriends(GlobalEngine.socialNetwork.getFriendUsers());
                Global.player.appFriends = GlobalEngine.socialNetwork.getAppFriendsIds();
                UI.populateNeighborsBar();
            } else {
                if (null == this.m_friendsTimer){
                    this.m_friendsTimer = new Timer(SETUP_FRIENDS_TIMER_DELAY);
                    this.m_friendsTimer.addEventListener(TimerEvent.TIMER, this.setupPlayerFriends);
                    this.m_friendsTimer.start();
                };
            };
        }

    }
}//package Init 
